package com.ruoyi.web.controller.vis;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SysCheck;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.vis.domain.VisCase;
import com.ruoyi.system.vis.domain.VisPreCheck;
import com.ruoyi.system.vis.service.VisPerCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/vis/precheck")
public class VisPerCheckController extends BaseController {
    @Autowired
    private VisPerCheckService visPerCheckService;

    //添加检查处方
    @PutMapping("/{checkIds}")
    public AjaxResult add(@PathVariable Long[] checkIds,@Validated @RequestBody Long patientId)
    {
        System.out.println("-=================================================");
        System.out.println(patientId);
        for (Long checkId : checkIds) {
            System.out.println(checkId);
        }
        return toAjax(visPerCheckService.add(patientId,checkIds));
    }

    //批量查询
    @PostMapping("/temList")
    public TableDataInfo list(@RequestBody long patientId){
        startPage();
        List<SysCheck> list = visPerCheckService.selectCheckByPatientId(patientId);
        return getDataTable(list);
    }
    //确认添加检查处方
    @PostMapping("/confirmCheck")
    public AjaxResult add(@RequestBody long patientId)
    {

        return toAjax(visPerCheckService.confirmCheck(patientId));
    }
}
